import axios from './api' // 倒入 api
import config from './config.js' // 倒入默认配置
export const BASEURL = config.baseURL
/* 将所有接口统一起来便于维护
 * 如果项目很大可以将 url 独立成文件，接口分成不同的模块
 */

/** 腾讯广告预上报接口 */
export const MARKETINGADD = (params) => {
  return axios({
    url: '/center/marketing/add',
    method: 'GET',
    params,
  })
}

/** 获取城市列表 */
export const GETCITYLIST = (params) => {
  return axios({
    url: '/crm/mp/city?level=2',
    method: 'GET',
    params,
  })
}

/** 解析客户IP所在城市 */
export const GETIPINFO = (params) => {
  return axios({
    url: '/center/common/getIp',
    method: 'GET',
    data: params,
  })
}

/** 获取手机号码归属地 */
export const GETMOBILEADDRESS = (params) => {
  return axios({
    url: '/dialogue/mobile/city/get',
    method: 'GET',
    params,
  })
}

/** 发送短信验证码 */
export const GETCODE = (params) => {
  return axios({
    url: '/dialogue/customer/code/send',
    method: 'GET',
    params,
  })
}

/** 提交表单 */
export const SAVEINFO = (params) => {
  let oParams = JSON.parse(JSON.stringify(params))
  delete oParams.code
  return axios({
    url: '/dialogue/customer/apply?code=' + params.code,
    method: 'POST',
    data: oParams,
  })
}

/** 腾讯广告上报:表单提交后调用 */
export const SENDREPORTING = (params) => {
  return axios({
    url: '/center/marketing/reporting2',
    method: 'GET',
    params,
  })
}

/** 腾讯广告上报:表单提交后调用 */
export const SENDMARKETINGREPORTING = (params) => {
  return axios({
    url: '/center/marketing/reporting',
    method: 'GET',
    params,
  })
}

// 获取城市
export const GETONECITY = (params) => {
  return axios({
    url: 'dialogue/customer/one/city',
    method: 'GET',
    params,
  })
}

// 提交资料
export const ACCOUNTINGAPPLY = (params) => {
  return axios({
    url: 'dialogue/accounting/apply',
    method: 'POST',
    data: params,
  })
}

// 信用逾期-问题-申请记录
export const GETCREDITPARAM = (params) => {
  return axios({
    url: '/dialogue/credit/param',
    method: 'GET',
    params,
  })
}

// 提交资料
export const CREDITAPPLY = (params) => {
  return axios({
    url: 'dialogue/credit/apply',
    method: 'POST',
    data: params,
  })
}

/** 获取所有城市列表 */
export const GETALLCITYLIST = (params) => {
  return axios({
    url: '/dialogue/customer/all/city?level=2',
    method: 'GET',
    params,
  })
}

/** 获取所有城市列表 */
export const GETALLTHREECITYLIST = (params) => {
  return axios({
    url: '/dialogue/customer/three/city',
    method: 'GET',
    params,
  })
}

// 获取特定的城市列表
export const GET_SPECILE_CITY = (params) => {
  return axios({
    url: '/dialogue/customer/three/city/list',
    method: 'GET',
    params,
  })
}
